/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gui.principal;

import br.gui.servidor.IServidor;
import br.gui.view.GUIAlterarHospede;
import br.gui.view.GUIAlterarHotel;
import br.gui.view.GUICadastrarHospede;
import br.gui.view.GUICadastrarHotel;
import br.gui.view.GUICriarReserva;
import br.gui.view.GUIExtenderReserva;
import br.gui.view.GUIGerarConta;
import br.gui.view.GUIRemoverHospede;
import br.gui.view.GUIRemoverHotel;
import br.gui.view.GUISobre;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
 *
 * @author Anderson
 */
public class Principal extends javax.swing.JFrame implements Serializable{
    private IServidor servidor;
    private GUISobre guiSobre;
    private GUIAlterarHospede guiAlterarHospede;
    private GUIAlterarHotel guiAlterarHotel;
    private GUICadastrarHospede guiCadastrarHospede;
    private GUICadastrarHotel guiCadastrarHotel;
    private GUICriarReserva guiCriarReserva;
    private GUIExtenderReserva guiExtenderReserva;
    private GUIGerarConta guiGerarConta;
    private GUIRemoverHospede guiRemoverHospede;
    private GUIRemoverHotel guiRemoverHotel;
    /**
     * Creates new form Principal
     */
    
    
    public Principal() {
        initComponents();
        setLocationRelativeTo(null);
//        try {
//            servidor = (IServidor) Naming.lookup("//localhost:6000/redehoteis");
//        } catch (NotBoundException | MalformedURLException | RemoteException ex) {
//            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
//        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jMenuBar = new javax.swing.JMenuBar();
        jArquivo = new javax.swing.JMenu();
        jSobre = new javax.swing.JMenuItem();
        jSair = new javax.swing.JMenuItem();
        j = new javax.swing.JMenu();
        jCadastrarHospede = new javax.swing.JMenuItem();
        jRemoverHospede = new javax.swing.JMenuItem();
        jAlterarHospede = new javax.swing.JMenuItem();
        jHotel = new javax.swing.JMenu();
        jCadastrarHotel = new javax.swing.JMenuItem();
        jRemoverHotel = new javax.swing.JMenuItem();
        jAlterarHotel = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jGerarConta = new javax.swing.JMenuItem();
        jReserva = new javax.swing.JMenu();
        jReservar = new javax.swing.JMenuItem();
        jExtender = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Rede de Hotéis Hilton");
        setBackground(new java.awt.Color(255, 255, 255));
        setPreferredSize(new java.awt.Dimension(1024, 700));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/gui/images/Hilton.jpg"))); // NOI18N
        jLabel1.setText("Jlabel1");

        jArquivo.setText("Arquivo");

        jSobre.setText("Sobre");
        jSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jSobreActionPerformed(evt);
            }
        });
        jArquivo.add(jSobre);

        jSair.setText("Sair");
        jSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jSairActionPerformed(evt);
            }
        });
        jArquivo.add(jSair);

        jMenuBar.add(jArquivo);

        j.setText("Hóspede");

        jCadastrarHospede.setText("Cadastrar Hospede");
        jCadastrarHospede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCadastrarHospedeActionPerformed(evt);
            }
        });
        j.add(jCadastrarHospede);

        jRemoverHospede.setText("Remover Hospede");
        jRemoverHospede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRemoverHospedeActionPerformed(evt);
            }
        });
        j.add(jRemoverHospede);

        jAlterarHospede.setText("Alterar Hospede");
        jAlterarHospede.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jAlterarHospedeActionPerformed(evt);
            }
        });
        j.add(jAlterarHospede);

        jMenuBar.add(j);

        jHotel.setText("Hotel");

        jCadastrarHotel.setText("Cadastrar Hotel");
        jCadastrarHotel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCadastrarHotelActionPerformed(evt);
            }
        });
        jHotel.add(jCadastrarHotel);

        jRemoverHotel.setText("Remover Hotel");
        jRemoverHotel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRemoverHotelActionPerformed(evt);
            }
        });
        jHotel.add(jRemoverHotel);

        jAlterarHotel.setText("Alterar Hotel");
        jAlterarHotel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jAlterarHotelActionPerformed(evt);
            }
        });
        jHotel.add(jAlterarHotel);
        jHotel.add(jSeparator1);

        jGerarConta.setText("Gerar Conta");
        jGerarConta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jGerarContaActionPerformed(evt);
            }
        });
        jHotel.add(jGerarConta);

        jMenuBar.add(jHotel);

        jReserva.setText("Reserva");

        jReservar.setText("Criar Reserva");
        jReservar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jReservarActionPerformed(evt);
            }
        });
        jReserva.add(jReservar);

        jExtender.setText("Extender Reserva");
        jExtender.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jExtenderActionPerformed(evt);
            }
        });
        jReserva.add(jExtender);

        jMenuBar.add(jReserva);

        setJMenuBar(jMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        getAccessibleContext().setAccessibleName("");
        getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSairActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jSairActionPerformed

    private void jSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSobreActionPerformed
        // TODO add your handling code here:
        guiSobre = new GUISobre();
        guiSobre.setPosicao();
        guiSobre.setVisible(true);
    }//GEN-LAST:event_jSobreActionPerformed

    private void jCadastrarHospedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCadastrarHospedeActionPerformed
        // TODO add your handling code here:
        guiCadastrarHospede = new GUICadastrarHospede();
        guiCadastrarHospede.setPosicao();
        guiCadastrarHospede.setVisible(true);
    }//GEN-LAST:event_jCadastrarHospedeActionPerformed

    private void jRemoverHospedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRemoverHospedeActionPerformed
        // TODO add your handling code here:
        guiRemoverHospede = new GUIRemoverHospede();
        guiRemoverHospede.setPosicao();
        guiRemoverHospede.setVisible(true);
    }//GEN-LAST:event_jRemoverHospedeActionPerformed

    private void jAlterarHospedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAlterarHospedeActionPerformed
        // TODO add your handling code here:
        guiAlterarHospede = new GUIAlterarHospede();
        guiAlterarHospede.setPosicao();
        guiAlterarHospede.setVisible(true);
    }//GEN-LAST:event_jAlterarHospedeActionPerformed

    private void jCadastrarHotelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCadastrarHotelActionPerformed
        // TODO add your handling code here:
        guiCadastrarHotel = new GUICadastrarHotel();
        guiCadastrarHotel.setPosicao();
        guiCadastrarHotel.setVisible(true);
    }//GEN-LAST:event_jCadastrarHotelActionPerformed

    private void jRemoverHotelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRemoverHotelActionPerformed
        // TODO add your handling code here:
        guiRemoverHotel = new GUIRemoverHotel();
        guiRemoverHotel.setPosicao();
        guiRemoverHotel.setVisible(true);
    }//GEN-LAST:event_jRemoverHotelActionPerformed

    private void jAlterarHotelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAlterarHotelActionPerformed
        // TODO add your handling code here:
        guiAlterarHotel = new GUIAlterarHotel();
        guiAlterarHotel.setPosicao();
        guiAlterarHotel.setVisible(true);
    }//GEN-LAST:event_jAlterarHotelActionPerformed

    private void jGerarContaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jGerarContaActionPerformed
        // TODO add your handling code here:
        guiGerarConta = new GUIGerarConta();
        guiGerarConta.setPosicao();
        guiGerarConta.setVisible(true);
    }//GEN-LAST:event_jGerarContaActionPerformed

    private void jReservarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jReservarActionPerformed
        // TODO add your handling code here:
        guiCriarReserva = new GUICriarReserva();
        guiCriarReserva.setPosicao();
        guiCriarReserva.setVisible(true);
    }//GEN-LAST:event_jReservarActionPerformed

    private void jExtenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jExtenderActionPerformed
        // TODO add your handling code here:
        guiExtenderReserva = new GUIExtenderReserva();
        guiExtenderReserva.setPosicao();
        guiExtenderReserva.setVisible(true);
    }//GEN-LAST:event_jExtenderActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        try {
            /*
             * Create and display the form
             */
            IServidor servidor = (IServidor) Naming.lookup("//localhost:6000/redehoteis");
        } catch (NotBoundException | MalformedURLException | RemoteException ex) {
            Logger.getLogger(GUICadastrarHospede.class.getName()).log(Level.SEVERE, null, ex);
        }
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new Principal().setVisible(true);
                              
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu j;
    private javax.swing.JMenuItem jAlterarHospede;
    private javax.swing.JMenuItem jAlterarHotel;
    private javax.swing.JMenu jArquivo;
    private javax.swing.JMenuItem jCadastrarHospede;
    private javax.swing.JMenuItem jCadastrarHotel;
    private javax.swing.JMenuItem jExtender;
    private javax.swing.JMenuItem jGerarConta;
    private javax.swing.JMenu jHotel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar;
    private javax.swing.JMenuItem jRemoverHospede;
    private javax.swing.JMenuItem jRemoverHotel;
    private javax.swing.JMenu jReserva;
    private javax.swing.JMenuItem jReservar;
    private javax.swing.JMenuItem jSair;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JMenuItem jSobre;
    // End of variables declaration//GEN-END:variables
    
}
